<template>
  <div>
    <el-dialog
      title="请选择插件"
      :append-to-body="true"
      @close="closeDio"
      :visible="dialogTableVisible"
      width="800px"
      style="padding:20px"
    >
      <ul class="cate_product" v-loading="loading">
        <li v-for="(item,index) in cj_data.data" :key="index" @click="add_cj(item)">{{item.title}}</li>
      </ul>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: "xz_chajian",
  props: {
    show: {
      type: Boolean,
      default: true
    },
    showType: {
      type: String,
      default: "table"
    }
  },
  data() {
    return {
      dialogTableVisible: this.show,
      cj_data: [],
      loading: false
    };
  },
  created() {
    this.get_chajian();
  },
  methods: {
    closeDio() {
      this.$emit("isshow", false);
      this.dialogTableVisible = false;
    },
    add_cj(row) {
      row.url_title = "插件管理";
      this.$emit("sendShop", row);
      this.closeDio();
    },
    get_chajian() {
      this.$api.getConfig.getList({}).then(res => {
        this.cj_data = res.data.result.business;
      });
    }
  },
  watch: {
    show(val1, val2) {
      if (val1 == val2) {
        return;
      }
      this.get_chajian();
      this.dialogTableVisible = val1;
    },
    dialogTableVisible(val1, val2) {
      if (val1 == val2) {
        return;
      }
      this.$emit("isshow", val1);
    }
  }
};
</script>

<style  lang="less"  scoped>
.cate_product {
  display: flex;
  flex-wrap: wrap;
  > li {
    width: 25%;
    height: 30px;
    line-height: 30px;
    cursor: pointer;
  }
  li:hover {
    color: red;
  }
}
</style>